<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>分页</title>
</head>
<body>
<div style="float: left;width: 300px;">
    <span>总页码数:${pageModel.totalPage}</span>
    <span>当前页：${pageModel.currentPage}</span>
    <sapn><a href="${param.path}?currentPage=1">首页</a></sapn>
    <span>总记录数:${pageModel.totalPage * 5}</span>
</div>
<div style="float: right;width: 300px">
    <c:choose>
        <c:when test="${pageModel.currentPage == 1}">
            <a>上一页</a>
        </c:when>
        <c:otherwise>
            <a href="${param.path}?currentPage=${pageModel.currentPage -1}">上一页</a>
        </c:otherwise>
    </c:choose>
    <c:forEach begin="${pageModel.beginPage}" end="${pageModel.endPage}" varStatus="status">
        <c:choose>
            <c:when test="${pageModel.currentPage == status.index}">
                <a style="color: green">${status.index}</a>
            </c:when>
            <c:otherwise>
                <a href="${param.path}?currentPage=${status.index}">${status.index}</a>
            </c:otherwise>
        </c:choose>
    </c:forEach>
    <c:choose>
        <c:when test="${pageModel.currentPage == pageModel.totalPage}">
            <a>下一页</a>
        </c:when>
        <c:otherwise>
            <a href="${param.path}?currentPage=${pageModel.currentPage + 1}">下一页</a>
        </c:otherwise>
    </c:choose>
    <span><a href="${param.path}?currentPage=${pageModel.totalPage}">尾页</a></span>
</div>
</body>
</html>
